package com.hongyuan.sellfitness.ui.message.activity;

import android.os.Bundle;

import androidx.lifecycle.ViewModelProviders;

import com.hongyuan.sellfitness.R;
import com.hongyuan.sellfitness.base.AppViewModelFactory;
import com.hongyuan.sellfitness.base.Constants;
import com.hongyuan.sellfitness.base.CustomActivity;
import com.hongyuan.sellfitness.databinding.ActivityMsgPraiseDetailBinding;
import com.hongyuan.sellfitness.ui.message.view_mode.MsgPraiseDetailViewModel;

import me.tatarka.bindingcollectionadapter2.BR;

public class MsgPraiseDetailActivity extends CustomActivity<ActivityMsgPraiseDetailBinding, MsgPraiseDetailViewModel> {

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_msg_praise_detail;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public MsgPraiseDetailViewModel initViewModel() {
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this, factory).get(MsgPraiseDetailViewModel.class);
    }

    @Override
    public void initView() {
        super.initView();
        setOnRefresh(binding.refresh,REFRESH_0X3);

        setEnableLoadMore(Constants.GET_PRAISE_LIST);
        setEnableRefresh(Constants.GET_PRAISE_LIST);

        binding.comBack.setOnClickListener(view -> finish());
    }

    @Override
    public void initData() {
        super.initData();

        viewModel.clearParams().setParams("circle_id",getBundle().getString("circle_id"));
        viewModel.requestData(Constants.GET_CIRCLE_INFO);
        viewModel.requestData(Constants.GET_PRAISE_LIST);
    }

}
